<?php
namespace Admin\Controller;


class UserdeprelController extends AbstractController  {
	
	protected $Form;

	public function _initialize(){
		$this->Form = D('User_dep_rel as rel');
    }
	
    public function getuserinfo($id){
    	$id = (int)$id;
    	if(!empty($id)){
    		$fields = 'u.ID AS ID, u.UserName AS Name';
    		$UserDepData['DepID'] = $id;
            $res = $this->Form->join('left join User as u on rel.UserID = u.ID')->where($UserDepData)->field($fields)->select();
			$this->ajaxReturn($res);
    	}
    }
    
    public function getNULLuserList(){
    	$sql = "SELECT b.*,b.UserName AS Name FROM user_dep_rel AS a RIGHT JOIN user AS b ON (a.UserID = b.ID) WHERE a.UserID IS NULL";
    	$res = $this->Form->query($sql);
    	$this->ajaxReturn($res);
    }
	
}